import {defineAsyncComponent} from "vue";
import type { Component } from "vue";
import {FlowNodeType} from "../types/index";

const NodeComponents = import.meta.glob('./**/index.vue') //批量导入所有的流程节点 vue组件
console.log(NodeComponents)
//批量导出所有的component下面的表单组件
export const NodeComponentsMap:{
  [key in FlowNodeType]:any
} = {} as any
Object.keys(NodeComponents).forEach((key) => {

  const name = key.replace(/^\.\/([\d\D]+?)\/([\d\D]+?)\.vue$/, '$1')

  NodeComponentsMap[name as FlowNodeType] = defineAsyncComponent(NodeComponents[key] as any)
})